package com.hbnu.system.controller;

import com.hbnu.system.core.base.Rest;
import com.hbnu.system.model.entity.Award_Qualification;
import com.hbnu.system.service.IAwardQualificationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/awardqulification")
@Api(tags = "获奖量化模块")
public class AwardQualificationController {
    @Autowired
    private IAwardQualificationService iAwardQualificationService;

    @ApiOperation("获奖量化添加")
    @PostMapping("/addAwardQualification")
    public Rest<Boolean> addAwardQualification(@RequestBody Award_Qualification award_qualification){
        boolean add = iAwardQualificationService.addAward_Qualification(award_qualification);
        return add ? Rest.success() : Rest.failed();
    }

    @ApiOperation("获奖量化删除")
    @GetMapping("/deleteAwardQulification")
    public Rest<Boolean> deleteAwardQulification(String AwardQualificationID){
        boolean delete = iAwardQualificationService.deleteAward_Qualification(AwardQualificationID);
        return delete ? Rest.success() : Rest.failed();
    }

    @ApiOperation("获奖量化查看")
    @GetMapping("/getAwardQulification")
    public Rest<List<Award_Qualification>> getAwardQulification(String AwardID){
        List<Award_Qualification> oneAward_qualification = iAwardQualificationService.getOneAward_Qualification(AwardID);

        return Rest.success(oneAward_qualification);
    }

    @ApiOperation("校级管理员修改量化分数")
    @PostMapping("/upAwardScore")
    public Rest<Boolean> upAwardScore(@RequestBody Award_Qualification award_qualification ){
        boolean update = iAwardQualificationService.upAwardScore(award_qualification);
        return update ? Rest.success() : Rest.failed();
    }

}
